package wordroid.activitys;

import java.util.ArrayList;

import wordroid.database.DataAccess;
import wordroid.model.Word;
import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;

public class studyWord extends Activity
  implements View.OnClickListener
{
  private Button add;
  private Button beforeone;
  private int currentnum;
  private TextView info;
  private ArrayList<Word> list = new ArrayList();
  private String listnum;
  private Button nextone;
  private int numoflist;
  private ImageButton speak;
  private TextView spelling;
  private TextToSpeech tts;
  private TextToSpeech.OnInitListener ttsInitListener ;//= new 1(this);
  private TextToSpeech.OnUtteranceCompletedListener ttsUtteranceCompletedListener ;//= new 2(this);
  private TextView tv;
  private TextView tv2;

  private void UpdateView()
  {/*
    if (this.currentnum == 0)
    {
      this.beforeone.setEnabled(false);
      if (getSharedPreferences("wordroid.model_preferences", 0).getBoolean("iftts", false))
        label15: new Thread(new 5(this)).start();
      if (this.currentnum >= this.numoflist)
        break label205;
      this.spelling.setText(((Word)this.list.get(this.currentnum)).getID() + "." + ((Word)this.list.get(this.currentnum)).getSpelling());
      this.info.setText(((Word)this.list.get(this.currentnum)).getPhonetic_alphabet() + "\n" + ((Word)this.list.get(this.currentnum)).getMeanning());
    }
    while (true)
    {
      return;
      if (this.currentnum > 0);
      this.beforeone.setEnabled(true);
      break label15:
      label205: if (this.currentnum < this.numoflist)
        continue;
      DataAccess localDataAccess = new DataAccess(this);
      WordList localWordList = (WordList)localDataAccess.QueryList("BOOKID ='" + DataAccess.bookID + "'AND LIST = '" + this.listnum + "'", null).get(0);
      localWordList.setLearned("1");
      localWordList.setReview_times("0");
      localWordList.setReviewTime("");
      Calendar localCalendar = Calendar.getInstance();
      localWordList.setLearnedTime(new SimpleDateFormat("yyyy-MM-dd").format(localCalendar.getTime()));
      localDataAccess.UpdateList(localWordList);
      this.currentnum = (-1 + this.currentnum);
      new AlertDialog.Builder(this).setIcon(2130837509).setTitle("学习已完成").setMessage("您可以依照复习计划进行本单元的复习").setPositiveButton("确定", new 6(this)).create().show();
    }
  */}

  private void initWidgets()
  {
    this.add = ((Button)findViewById(2131165228));
    this.add.setOnClickListener(this);
    this.info = ((TextView)findViewById(2131165227));
    this.beforeone = ((Button)findViewById(2131165244));
    this.beforeone.setOnClickListener(this);
    this.nextone = ((Button)findViewById(2131165233));
    this.nextone.setOnClickListener(this);
    this.spelling = ((TextView)findViewById(2131165226));
    Typeface localTypeface = Typeface.createFromAsset(getAssets(), "fonts/SEGOEUI.TTF");
    this.info.setTypeface(localTypeface);
    this.speak = ((ImageButton)findViewById(2131165243));
// this.tts = new TextToSpeech(this, this.ttsInitListener);
    this.speak.setOnClickListener(this);
    new DisplayMetrics();
    int i = getApplicationContext().getResources().getDisplayMetrics().widthPixels;
    this.add.setWidth(i / 3);
    this.beforeone.setWidth(i / 3);
    this.nextone.setWidth(i / 3);
  }

  public void onClick(View paramView)
  {
    Log.i("3", "3");
    UpdateView();
    Log.i("3", "3");
    if (paramView == this.nextone)
      if (this.currentnum < this.numoflist)
      {
        this.currentnum = (1 + this.currentnum);
        UpdateView();
      }
    while (true)
    {/*
      Log.i("3", "3");
      if (paramView == this.speak)
        this.tts.speak(((Word)this.list.get(this.currentnum)).getSpelling(), 1, null);
      Log.i("3", "3");
      return;
      if (paramView == this.add)
      {
        DataAccess localDataAccess = new DataAccess(this);
        new ArrayList();
        if (localDataAccess.QueryAttention("SPELLING ='" + ((Word)this.list.get(this.currentnum)).getSpelling() + "'", null).size() == 0)
        {
          localDataAccess.InsertIntoAttention((Word)this.list.get(this.currentnum));
          Toast.makeText(this, "已加入生词本", 0).show();
        }
        Toast.makeText(this, "生词本中已包含这个单词！", 0).show();
      }
      if (paramView != this.beforeone)
        continue;
      this.currentnum = (-1 + this.currentnum);
      UpdateView();*/
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903055);
    this.currentnum = 0;
    String str = getIntent().getExtras().getString("list");
    this.listnum = str;
    setTitle("学习LIST-" + str);
    this.list = new DataAccess(this).QueryWord("LIST = '" + str + "'", null);
    this.numoflist = this.list.size();
    initWidgets();
    UpdateView();
  }

  protected void onDestroy()
  {
    super.onDestroy();
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    /*if (paramInt == 4)
      new AlertDialog.Builder(this).setIcon(2130837509).setTitle("学习未完成").setMessage("你确定现在结束学习吗？这将导致本次学习无效！").setPositiveButton("确定", new 3(this)).setNegativeButton("取消", new 4(this)).create().show();
*/    return true;
  }
}

/* Location:           E:\Desktop\Android\英语词汇记忆\classes_dex2jar.jar
 * Qualified Name:     wordroid.activitys.studyWord
 * JD-Core Version:    0.5.3
 */